Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlc: remove wrong unique schema.sql.rules check #227

Merged
merged 2 commits into from
Aug 31, 2024

Conversation

YvanDaSilva
Copy link
Contributor

@YvanDaSilva YvanDaSilva commented Aug 30, 2024

The check was not testing for a valid case.
schema.sql.rules are not unique among multiple sql objects. This commit also adds a second sql object to test_yaml_sample in order to catch this case if rules are changed.

1. Please confirm that you have read the document before PR submitted

2. Contact Information(Optional)

If it is convenient, please provide your contact information so we can reach you when processing the PR:

  • Email:
  • HomePage:

Without this change, a multi sql entry would fail if they re-used the same rules which is the expected case for sqlc:

kcl test
test_rule: PASS (8ms)
test_plugin: PASS (7ms)
test_plugin_invalid_url: PASS (6ms)
test_gotype_override: PASS (6ms)
test_type_override: PASS (6ms)
test_type_override_advanced: PASS (5ms)
test_database: PASS (5ms)
test_codegen: PASS (5ms)
test_jsongen: PASS (5ms)
test_gogen: PASS (5ms)
test_gogen_options: PASS (6ms)
test_sqlanalyzer: PASS (6ms)
test_configsql: PASS (6ms)
test_configschema: PASS (6ms)
test_json_sample: PASS (5ms)
test_yaml_sample: FAIL (6ms)
EvaluationError
   --> /kcl-modules/sqlc/sqlc_test.k:309:1
    |
309 |     cfg :ConfigSchema = yaml.decode(yl)
    | ^ Instance check failed
    |

  --> /kcl-modules/sqlc/sqlc.k:25:1
   |
25 |         isunique(allSqlRules()), "sql.rules must be unique"
   |  Check failed on the condition: sql.rules must be unique
   |

The check was not testing for a valid case.
schema.sql.rules are not unique among multiple sql objects.
This commit also adds a second sql object to test_yaml_sample
in order to catch this case if rules are changed.
@Peefy Peefy merged commit 0dd55d9 into kcl-lang:main Aug 31, 2024
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants